// store/modules/chat.js

const state = {
  sendItem: null, // 用来存储 sendItem 数据
  receiveItem:null
};

const mutations = {
  setSendItem(state, sendItem) {
    state.sendItem = sendItem; // 更新 sendItem 数据
  },
  setReceiveItem(state, receiveItem) {
    state.receiveItem = receiveItem; // 更新 sendItem 数据
  },
};

const actions = {
  updateSendItem({ commit }, sendItem) {
    commit('setSendItem', sendItem); // 提交 mutation 来更新 sendItem
  },
  updateReceiveItem({ commit }, receiveItem) {
    commit('setReceiveItem', receiveItem); // 提交 mutation 来更新 sendItem
  },
};

const getters = {
  getSendItem(state) {
    return state.sendItem; // 获取 sendItem 数据
  }, 
  getReceiveItem(state) {
    return state.receiveItem; // 获取 sendItem 数据
  },
};

export default {
  state,
  mutations,
  actions,
  getters
};
